<!-- Aside 侧边栏 -->
<template>
  <div style="height:100vh; overflow: auto;">
    <el-menu :default-openeds="[]" unique-opened 
      style="height: 100%; 
      background-color: #304156;" 
      text-color="#F4F4F5" 
      active-text-color="#399EE0" 
      :collapse-transition="false"
      :collapse="isCollapse" router>

      <div style="margin: 0 auto; text-align: center; margin-top: 10px; display: flex; margin-left: 9%; align-items: center;">
        <img src="../assets/语.png" alt="" style="width: 25%; height: 25%;">
        <b style="color: rgb(255, 255, 255); font-size: 14px;" v-show="logitextshow">成语大天才管理系统</b>
      </div>

      <div v-for="item in menus" :key="item.id">
        <div v-if="item.path">
          <el-menu-item :index="item.path">
            <i :class="item.icon"></i>
            <span slot="title">{{ item.mname }}</span>
          </el-menu-item>
        </div>
        <div v-else>
          <el-submenu :index="item.id + ''">
            <template slot="title">
              <i :class="item.icon"></i>
              <span slot="title">{{ item.mname }}</span>
            </template>
            <div v-for="subItem in item.children" :key="subItem.id">
              <el-menu-item :index="subItem.path">
                <i :class="subItem.icon"></i>
                <span slot="title">{{ subItem.mname }}</span>
              </el-menu-item>
            </div>
          </el-submenu>
        </div>
      </div>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: "Aside",
  props: {
    isCollapse: Boolean,
    logitextshow: Boolean,
  },
  data() {
    return {
      menus: localStorage.getItem("menus") ? JSON.parse(localStorage.getItem("menus")) : [],
      //侧边栏默认展开
      // opens: localStorage.getItem("menus") ? JSON.parse(localStorage.getItem("menus")).map(v => v.id + '') : []
    };
  },
};
</script>

 <style>
.el-menu-item.is-active {
  background-color: #001528 !important;
}
.el-menu-item:hover {
  background-color: #001528 !important;
}

.el-submenu__title:hover {
  background-color: #001528 !important;
}
/*解决收缩菜单文字不消失问题*/
.el-menu--collapse span {
  visibility: hidden;
}
.el-menu{
  background-color:#1F2D3D ;
}
.el-menu-item.is-active {
  color: #236DF3; /* 你想要的字体颜色 */
}
</style>
